#include <zmq.hpp>
#include <string>
#include <iostream>

int main() {
    zmq::context_t context(1);
    zmq::socket_t publisher(context, ZMQ_PUB);
    publisher.bind("tcp://*:5556");  								// 绑定到一个端口

    while (true) {
        zmq::message_t message(20);
        snprintf((char *)message.data(), 20 , "Update %d", rand() % 100);
        publisher.send(message, zmq::send_flags::none);
        std::this_thread::sleep_for(std::chrono::seconds(1)); 		// 发送更新间隔
    }
    return 0;
}